package com.yx.common.swagger.config.properties;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;


@Configuration
public class SwaggerConfig {

    @Profile({"dev", "test"}) // 只在 dev 和 test 环境下启用 Swagger UI
    @Bean
    public OpenAPI customOpenAPI() {

        return new OpenAPI()
                .info(new Info().title("你的项目名称").description("Spring Boot3 Restful API").version("V1.0.0")
                        .license(new License().name("访问SpringDoc官方网站").url("https://springdoc.org")))
                .externalDocs(
                        new ExternalDocumentation().description("访问服务").url("https://172.30.63.85/v1"));
    }

}